<img style="position:absolute;left:0px;top:0px;width:20px;height:20px;" id="ball"/>
<script>
var n=Math.PI*2*Math.random()-Math.PI;
setInterval("myinterval();",100);

function myinterval(){
ballmov(ball,parseInt(ball.style.left)+10*Math.cos(n),parseInt(ball.style.top)+10*Math.cos(n));
}

function ballmov(b,x,y){
window.status=x+"d"+y;
//check1(x,y,20,20,0,0,document.body.clientWidth,document.body.clientHeight);
}

function check1(x1,y1,width1,height1,x2,y2,width2,height2){
return true;
if(x1<x2)return 0;
if(y1<y2)return 1;
if(x1+width1>x2+width2)return 0;
if(y1+width1>y2+height2)return 1;
}
</script>